package com.hspedu.wrapper;

/**
 * @Author Stringzhua
 * @Date 2024/3/8 16:44
 * description:查看下面的代码是否正确
 */
public class WrapperExercise01 {
    public static void main(String[] args) {
        Double d = 100d;//ok,体现了自动装箱 Double.valueOf(100d)
        Float f = 1.5f;//ok,自动装箱 Float.valueOf(1.5f)
        //正确
        Object object1 = true ? new Integer(1) : new Double(2.0);//三元运算符--一真大师
        System.out.println("object1 = " + object1);//1.0

        Object object2;
        if (true) {
            object2 = new Integer(1);
        } else {
            object2 = new Double(2.0);
        }
        System.out.println("object2 = " + object2);//1
    }
}
